

#pragma once
#include "common.h"
#include "Model.h"
#include "DisplayManage.h"
#include "Widget.h"
#include "Container.h"
#define MAX_IMAGE_FILE_LENGTH 128
#define MAX_BATCH_DRAW_CMD 512
class DLL_EXP CImageWidget : public CWidget
{
public:

	CImageWidget(void);
	virtual ~CImageWidget(void);
	char  m_pImageFile[MAX_IMAGE_FILE_LENGTH];
	char* m_pMaskBmpFile;
	IMAGE_HANDLE m_imageHandle;
	WCHAR* m_pLabel;
	bool m_bTransparent;
	int m_offset_x;
	int m_total_imgs;
	int m_mask_offset_x;
	char m_img_draw_cmd[MAX_BATCH_DRAW_CMD];
	
public:

	virtual int Draw(CFrameSurface* pSurface);
	virtual int CustDraw(CFrameSurface* pSurface);


	//
	//"[H,V]:[CMD_NUM],[([bmp_X],[bmp_Y],[bmp_DX],[bmp_DY]),...] [REPEAT_NUM], \
		[BMP_MASK,MASK_SELF]:[MASK_NUM],[(mask_X,mask_Y,mask_DX,mask_DY,)...]";

	// H/V means the direction of Draw
	// CMD_NUM means the number of draw command
	// bmp_x,y,dx,dy, means the bitmap position in the input bitmap
	// Repeat_num , means what times repeated last command
	// BMP_MASK/MASK_SELF, means use which type mask, BMP_MASK means get the mask in follow position, 
	// MASK_SELF means the bmp contains the mask itself, use the top_lef pixel color to create a mask.
	
	
	void setImage(char* file,char* img_batch_draw_cmd)
	{
		memset(m_img_draw_cmd,0,sizeof(m_img_draw_cmd));
		strcpy(m_img_draw_cmd,img_batch_draw_cmd);

		//make sure the last char is ',' , will be used as a end flag.
		m_img_draw_cmd[strlen(m_img_draw_cmd)-1]=',';
		
		strcpy(m_pImageFile,file);
	}

	void setLabel(WCHAR* string)
	{
		
	}

};
